package uk.co.q3c.deplan.server.user;

import java.io.File;

public class CurrentUser {
	private static boolean admin;
	static String name = null;

	public static String getName() {
		if (name == null) {
			throw new RuntimeException("CurrentUser.getName() needs correcting");
			// name = SystemUtils.USER_NAME;
		}
		if (name.equals("dave")) {
			name = "dsowerby";
		}

		if (name.equals("mpaine")) {
			admin = true;
		}
		if (name.equals("dsowerby")) {
			admin = true;
		}
		return name;
	}

	public static boolean isAdmin() {
		return admin;
	}

	public static File homeDirectory() {
		File dir = new File(System.getProperty("user.home"));
		return dir;
	}

	public static File dePlanDirectory() {
		return new File(dePlanDirectoryName());
	}

	public static String dePlanDirectoryName() {
		return System.getProperty("user.home") + File.separator + "deplan";
	}

	/**
	 * returns a file name within the dePlanDirectory create from filename
	 * 
	 * @param string
	 * @return
	 */
	public static String dePlanDirectoryName(String filename) {
		return dePlanDirectoryName() + File.separator + filename;
	}
}
